package com.data.service

import com.data.annotation.NoargAnnotation
import com.data.annotation.OpenAnnotation
import com.data.bean.Account
import com.data.dao.LoginDao
import com.data.util.CheckDataUtils
import com.data.util.Md5CodeUtils
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

@Service
@OpenAnnotation
@NoargAnnotation
class LoginService {
    @Autowired
    var loginDao: LoginDao? = null

    /**
     * 登录相关的服务层
     *
     * @param username
     * @param password
     * @return
     */
    fun loginService(username: String, password: String): Account? {
        if (CheckDataUtils.stringUtils(username, password)) {
            println(username.trim())
            println(Md5CodeUtils.md5(password.trim()))
            return loginDao?.loginDao(username.trim(), Md5CodeUtils.md5(password.trim()))
        }
        return null
    }

}